import request from 'src/axios'

/**
 * @description 分页查询流转条件
 * @param { Object } params 查询参数
 * @returns Promise
 */
export const pageCondition = (params: object) => {
  return request.get('/flow/flowCondition/page', { params })
}

/**
 * @description 查看流转条件
 * @param { String } id 主键
 * @returns Promise
 */
export const viewCondition = (id: string) => {
  return request.get('/flow/flowCondition', { params: { id } })
}

/**
 * @description 新增流转条件
 * @param { Object } data 新增数据
 * @returns Promise
 */
export const saveCondition = (data: object) => {
  return request.post('/flow/flowCondition', data)
}

/**
 * @description 修改流转条件
 * @param { Object } data 修改数据
 * @returns Promise
 */
export const updateCondition = (data: object) => {
  return request.put('/flow/flowCondition', data)
}

/**
 * @description 删除流转条件
 * @param { Array<string> } ids 主键数组
 * @returns Promise
 */
export const deleteCondition = (ids: Array<string>) => {
  return request.delete('/flow/flowCondition', { data: ids })
}

/**
 * @description 启用流转条件
 * @param { String } id 主键
 * @returns Promise
 */
export const enableCondition = (id: string) => {
  return request.put('/flow/flowCondition/enable', { id })
}

/**
 * @description 禁用流转条件
 * @param { String } id 主键
 * @returns Promise
 */
export const disableCondition = (id: string) => {
  return request.put('/flow/flowCondition/disable', { id })
}
